package lm.concurrency.day5.singletons;

/**
 * @Auther: Min.Liu
 * @Description:
 * @Date: Created in 10:47 2024/11/7
 */

public final class Singleton3 {
    private Singleton3() { }
    private static Singleton3 INSTANCE = null;
    // 分析这里的线程安全, 并说明有什么缺点
    public static synchronized Singleton3 getInstance() {
        if( INSTANCE != null ){
            return INSTANCE;
        }
        INSTANCE = new Singleton3();
        return INSTANCE;
    }
}

